package loads

import (
	"hi-jvm/instructions/base"
	"hi-jvm/rtda"
)
// 指令码：0x16
type LLOAD struct{ base.Index8Instruction }

// 指令码：0x1e
type LLOAD_0 struct{ base.NoOperandsInstruction }
// 指令码：0x1f
type LLOAD_1 struct{ base.NoOperandsInstruction }
// 指令码：0x20
type LLOAD_2 struct{ base.NoOperandsInstruction }
// 指令码：0x21
type LLOAD_3 struct{ base.NoOperandsInstruction }

func (self *LLOAD) Execute(frame *rtda.Frame) {
	_lload(frame, self.Index)
}

func (self *LLOAD_0) Execute(frame *rtda.Frame) {
	_lload(frame, 0)
}

func (self *LLOAD_1) Execute(frame *rtda.Frame) {
	_lload(frame, 1)
}

func (self *LLOAD_2) Execute(frame *rtda.Frame) {
	_lload(frame, 2)
}

func (self *LLOAD_3) Execute(frame *rtda.Frame) {
	_lload(frame, 3)
}

func _lload(frame *rtda.Frame, index uint) {
	val := frame.LocalVars.GetLong(index)
	frame.OperandStack.PushLong(val)
}